package featuremodel;

import java.util.Vector;

import skyblue.SkyBlueDef;
import skyblue.ValueRep;
import skyblue.Variable;

public class FeatureRep extends ValueRep {

	private String name;
	// true for mandatory feature; false for optional feature
	private boolean isMandatory;
	// true for isolated features; false for the feature with parent and the
	// root feature
	private boolean isUndefined;
	private boolean isRoot;
	private Variable parent;
	private int bindState;
	//the relationship between the feature and its parent
	private String refinementType;
	private Vector<FeatureGroup> featureGroups;

	public FeatureRep(String name) {
		this.name = name;
		this.isMandatory = false;
		this.isUndefined = true;
		this.isRoot = false;
		this.parent = null;
		this.bindState = SkyBlueDef.VARIABLE_UNDECIDED;
		this.refinementType = null;
		this.featureGroups = new Vector<FeatureGroup>();
	}

	public boolean isBound() {
		if (this.bindState == SkyBlueDef.VARIABLE_BIND) {
			return true;
		}
		return false;
	}

	public boolean isUnBound() {
		if (this.bindState == SkyBlueDef.VARIABLE_UNBIND) {
			return true;
		}
		return false;
	}

	public boolean isUnDefined() {
		if (this.bindState == SkyBlueDef.VARIABLE_UNDECIDED) {
			return true;
		}
		return false;
	}

	public int getBindState() {
		return bindState;
	}

	public void setValue(int bindState) {
		this.bindState = bindState;
	}

	public void setBindState(int bindState) {
		this.bindState = bindState;
	}

	public Variable getParent() {
		return parent;
	}

	public void setParent(Variable parent) {
		this.parent = parent;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Vector<FeatureGroup> getFeatureGroups() {
		return featureGroups;
	}

	public void setFeatureGroups(Vector<FeatureGroup> featureGroups) {
		this.featureGroups = featureGroups;
	}

	public boolean isRoot() {
		return isRoot;
	}

	public void setRoot(boolean isRoot) {
		this.isRoot = isRoot;
	}

	public boolean isMandatory() {
		return isMandatory;
	}

	public void setMandatory(boolean isMandatory) {
		this.isMandatory = isMandatory;
	}

	public boolean isUndefined() {
		return isUndefined;
	}

	public void setUndefined(boolean isUndefined) {
		this.isUndefined = isUndefined;
	}

	public String getRefinementType() {
		return refinementType;
	}

	public void setRefinementType(String refinementType) {
		this.refinementType = refinementType;
	}

}
